package dao

import (
	"gitee.com/shuwenhe/shuwen-go/update/model"
	"gitee.com/shuwenhe/shuwen-go/update/utils"
)

func GetItemByID(id int) (*model.Item, error) {
	sql := "select id,title,author,price,sales,stock,img_path from items where id = ?"
	row := utils.Db.QueryRow(sql, id)
	item := &model.Item{}
	row.Scan(&item.ID, &item.Title, &item.Author, &item.Price, &item.Sales, &item.Stock, &item.ImgPath)
	return item, nil
}

func UpdateItem(*model.Item) {

}
